<template>
    <div class="table">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-date"></i>{{$route.name}}
                </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="handle-box">
            <el-dialog :title="title" :visible.sync="dialogFormVisible">
                <el-form :model="addForm">
                    <el-form-item label="发布时间" :label-width="formLabelWidth">
                        <el-date-picker v-model="addForm.time" type="date" value-format="yyyy年MM月dd日" placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="标题" :label-width="formLabelWidth">
                        <el-input type="text" v-model="addForm.title" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="作者" :label-width="formLabelWidth">
                        <el-input type="text" v-model="addForm.title" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="来源" :label-width="formLabelWidth">
                        <el-input type="text" v-model="addForm.title" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="内容" :label-width="formLabelWidth">
                        <el-input type="textarea" v-model="addForm.title" auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="附件" :label-width="formLabelWidth">
                        <el-input type="text" v-model="addForm.title" auto-complete="off"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="dialogFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="add">确 定</el-button>
                </div>
            </el-dialog>
            <el-input placeholder="输入标题" class="search"></el-input>
            <el-button type="primary" icon="search">搜索</el-button>
            <el-button type="primary" @click="addType">新增下载文件</el-button>
        </div>
        <div>
          <el-table :data="initData" border fit style="width: 100%">
              <el-table-column prop="time" label="发布时间" show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="title" label="标题" show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="name" label="作者" show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="souce" label="来源" show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="content" label="内容" show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="fu" label="附件" show-overflow-tooltip>
              </el-table-column>
              <el-table-column fixed="right" label="操作">
                  <template slot-scope="scope">
                      <el-button type="text" size="small" @click="edit(scope.row)">编辑</el-button>
                      <el-button type="text" size="small" @click="delNotice(scope.row)">删除</el-button>
                  </template>
              </el-table-column>
          </el-table>
        </div>
        <!-- <div class="block">
            <el-pagination @current-change="handleCurrentChange" :current-page="page.number+1" layout="total, prev, pager, next, jumper" :total="page.totalElements">
            </el-pagination>
        </div> -->
    </div>
</template>
<script>
// import {  } from "../../server/getDate.js";
import { mapState, mapActions } from 'vuex'
import { getStore } from '../../utils/local.js'
import { confirm } from '../../utils/local'
export default {
    data() {
        return {
          loading: false,
          dialogFormVisible: false,
          title: '',
          addForm: {},
          formLabelWidth: '120px',

          initData: [{
            time: '2018-06-04',
            title: '下载文件',
            name: '下载文件',
            souce: '下载文件',
            content: '下载文件',
            fu: '下载文件'
          }]
        }
    },
    created() {

    },
    methods: {
      edit(row) {
        this.dialogFormVisible = true
        this.title = '修改下载文件'
        this.addForm = row
      },
      delNotice(row) {
        this.$confirm('此操作将永久删除该信息, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        }).then(() => {
            this.$message({
                type: 'success',
                message: '删除成功!'
            });
        }).catch(() => {
            this.$message({
                type: 'info',
                message: '已取消删除'
            });
        });

    },
    add(){
        alert('成功')
        this.dialogFormVisible = false
    },
    addType(){
      this.dialogFormVisible = true
      this.title = '新增下载文件'
      this.addForm = {}
    }
  }


}
</script>
<style lang="scss" scoped>
.handle-box {
  margin-bottom: 1%;
  .search {
    width: 30%;
  }
}

.block {
  text-align: center;
  margin-top: 1%;
}
</style>
